package account

import (
	"github.com/labstack/echo"
)

func AccountRouter(app *echo.Echo) {

	app.POST("/account/login", func(c echo.Context) error {
		name := c.FormValue("name")
		psw := c.FormValue("psw")
		msg := login(name, psw)
		return c.JSON(200, msg)
	})

	app.POST("/account/register", func(c echo.Context) error {
		u := c.FormValue("user")
		msg := register(u)
		return c.JSON(200, msg)
	})
	app.POST("/account/resetpsw", func(c echo.Context) error {
		id := c.FormValue("id")
		psw := c.FormValue("psw")
		msg := resetPsw(id, psw)
		return c.JSON(200, msg)
	})

}
